<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/public/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>客户资源</title>
<% request.setAttribute("menu", 1); %>
<%@ include file="/WEB-INF/page/public/meta.jsp"%>
    
<script src="<%=basePath %>javascripts/page/sys/customerdistribute.js"
	type="text/javascript"></script>
</head>
<body>
	<div class="modal-shiftfix">
		<!-- Navigation -->
		
		<!-- End Navigation -->
		<div class="container-fluid main-content">


			<div class="row">
				<div class="col-lg-12">
					<ul class="breadcrumb">
						<li><a href="/manage"></a><i class="icon-home"></i></li>
						<li>销售管理</li>
						<li><a href="/systerm/getUserandCustomer">资源管理</a></li>
						<li class="active">客户资源  </li>
					</ul>
				</div>

				<div class="col-lg-12">
					<div class="widget-container fluid-height">
						<div class="heading tabs">

							<ul class="nav nav-tabs pull-left" data-tabs="tabs" id="tabs">
								<li class="active"><a data-toggle="tab"  href="#tab1"><i
										class="icon-user"></i><span>资源库</span></a></li>
							</ul>
						</div>
						<div class="tab-content padded" id="my-tab-content">
							<div class="tab-pane active" id="tab1">
								<div class="widget-container fluid-height clearfix">
									<div class="widget-content padded clearfix">
										<div class="" id="dataTable1_filter">
											  <form action="/systerm/getUserandCustomer"  method="post" >
											  
											  <div class="row">
														    <div class="col-lg-2">
							                    	 			<div class="form-group  ">
																	 <select 	class="form-control" id="createuser" name="createuser"    >
																	 
																		<c:forEach var="user" items="${userlist}">
														<option value="${user.aid}" <c:if test='${pager.params.get("createuser")==user.aid}'>selected</c:if>>${user.name}</option>
													</c:forEach>
																	</select>
																	 
																	
														  	 	</div>
														    </div>  
														    <div class="col-lg-2"> 
							                    	 			<div class="form-group  ">
																	 <input type="text" class="form-control" id="keyWord" name="keyWord" placeholder="请输入客户名称或商号" value="${pager.params.get('keyWord')}">
																    <input type="hidden"  name="skipToPage" value="1">
																   
														  	 	</div> 
														    </div> 
														     <div class="col-lg-2">
							                    	 			<div class="form-group  ">
																	<select 	class="form-control" id="calling"  name="calling"  >
																		<option value="">行业</option>
																		<dic:cf name="calling_category" type="2" 	value="${pager.params.get('calling')}" />
																	</select>
														  	 	</div>
														    </div> 
														     <div class="col-lg-2">
							                    	 			<div class="form-group  ">
																	<select 	class="form-control" id="productcategory" name="productcategory"  >
																		<option value="">产品类别</option>
																		<dic:cf name="product_category" type="2" 	value="${pager.params.get('productcategory')}" />
																	</select>
														  	 	</div>
														    </div> 
														     <div class="col-lg-2">
							                    	 			<div class="form-group  ">
																	<select 	class="form-control" id="state" name="state"  >
																		<option value="" <c:if test="${pager.params.get('state')==10}">selected = "selected"</c:if> >客户状态</option>
																		<option value="1" <c:if test="${pager.params.get('state')==1}">selected = "selected"</c:if> >线索库</option>
																		<option value="2" <c:if test="${pager.params.get('state')==2}">selected = "selected"</c:if>>跟踪库</option>
																		<option value="3" <c:if test="${pager.params.get('state')==3}">selected = "selected"</c:if>>意向库</option>
																		<option value="5" <c:if test="${pager.params.get('state')==5}">selected = "selected"</c:if>>订单跟踪</option>
																		<option value="6" <c:if test="${pager.params.get('state')==6}">selected = "selected"</c:if>>订单过期</option>
																		<option value="7" <c:if test="${pager.params.get('state')==7}">selected = "selected"</c:if>>合作库</option>
																	</select>
														  	 	</div>
														    </div>
														    <div class="col-lg-2">
							                    	 			<div class="form-group  "> 
							                    	 			<button class="btn  btn-success" type="submit"><i class="glyphicon glyphicon-search"></i> 查询</button>
																		     
														  	 	</div>
														    </div>  
												</div>
											   
													 
											</form>
										</div>
										 <div id="dataTable1_length" class="dataTables_length pull-right"> 
										 <a class="btn btn-sm btn-primary-outline pull-right"
											href="javascript:;"   onclick="get(0)" ><i class="icon-external-link"></i>分配客户</a>
										 <a class="btn btn-sm btn-primary-outline pull-right"
											href="javascript:;"   onclick="getall()" ><i class="icon-external-link"></i>分配所有客户</a>
										</div> 
										<table class="table table-bordered table-striped table-hover"
											id="dataTable1">
											<thead>
											<th class="check-header hidden-xs" width="3%"><label><input
														id="Allcheck" name="Allcheck"  type="checkbox"><span></span></label>
												</th>
												<th width="20%">客户名称</th>
												<th width="17%">商号</th>
												<th class="hidden-xs" style="width:10%;">行业</th>
												<th class="hidden-xs" style="width:10%;">产品类别</th>
												<th class="hidden-xs" style="width:10%;">所在省市</th>
												<th class="hidden-xs" style="width:10%;">联系人</th>
												<th class="hidden-xs" style="width:10%;">联系电话</th>
												<th></th>
											</thead>
											<tbody>
												<c:forEach var="cInfo" items="${pager.resultList}">
													<tr>
													<td class="check hidden-xs" width="3%"><label><input
																name="checkbox"  type="checkbox"
																value="${cInfo.id}"><span></span></label></td>
														
														<%
														 
														// net.crm.salesmanage.model.CustomerInfo  cinfo =   (net.crm.salesmanage.model.CustomerInfo)pageContext.getAttribute("cInfo");
													      String encryptString = "";//net.crm.util.Constants.CONTENT.encryptString(String.valueOf(cinfo.getId()));
														
														%>		
																
														<td><a  target="_blank" href="/customer/showinfo?encid=<%=encryptString%>">${cInfo.cname}</td>
														<td>${cInfo.firm}</td>
														<td class="hidden-xs"  ><dic:calling value="${cInfo.calling}"/></td>
														<td ><dic:cf value="${cInfo.productcategory}" name="product_category" 
														type="1"/></td>
														<td class="hidden-xs"  ><dic:city value="${cInfo.province}_${cInfo.city}"/></td>
														<td class="hidden-xs"  > <c:if test="${cInfo.contactsItem.size()>0}">${cInfo.contactsItem.get(0).name}</c:if>   </td>
														<td class="hidden-xs"  > <c:if test="${cInfo.contactsItem.size()>0}">${cInfo.contactsItem.get(0).phone}</c:if> </td>
														<td class="actions" >
														</td>
													</tr>
												</c:forEach>
											</tbody>
										</table>
										  ${pager.getShowPage() } 
									</div>
								</div>
							</div>

						</div>
					</div>
				</div>
			</div>


		</div>
	</div>
	
	 <!-- 资源分配 -->
	<div class="modal fade" id="myModal2">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button aria-hidden="true" class="close" data-dismiss="modal"
						type="button">&times;</button>
				</div>
				<div class="modal-body">

					<p>
					<div class="col-md-12">
						<div class="widget-container">
							<form action="" id="validatebound-form" method="post">
								<div class="heading">
									<i class="icon-reorder"></i> 资源分配
								</div>
								<div class="widget-content padded">
									<div class="row">
										<div class="col-md-12">
											<div>
												<label>用户列表</label> <select id="uid" name="uid"  
													class="form-control">
													
													<c:forEach var="user" items="${userlist}">
													     <option  value="${user.aid}">${user.name}</option>
													</c:forEach>
													
												</select>
											</div>
										</div>
									</div>
									
									<div class="row">
										<div class="col-md-10">
											<div class="form-group col-md-10">
												<input class="btn btn-primary"  onclick="updatecust()" type="button" value="保 存 ">
											</div>
										</div>
									</div>
								</div>
							</form>
						</div>
					</div>
					</p>
				</div>
			</div>
		</div>

	</div>
	<!-- 资源分配 --> 
	 <!-- 资源分配 -->
	<div class="modal fade" id="myModal3">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button aria-hidden="true" class="close" data-dismiss="modal"
						type="button">&times;</button>
				</div>
				<div class="modal-body">

					<p>
					<div class="col-md-12">
						<div class="widget-container">
							<form action="" id="validatebound-form" method="post">
								<div class="heading">
									<i class="icon-reorder"></i> 所有资源分配
								</div>
								<div class="widget-content padded">
									<div class="row">
										<div class="col-md-12">
											<div>
												<label>用户列表</label> <select id="uidall" name="uid"  
													class="form-control">
													
													<c:forEach var="user" items="${userlist}">
													     <option  value="${user.aid}">${user.name}</option>
													</c:forEach>
													
												</select>
											</div>
										</div>
									</div>
									
									<div class="row">
										<div class="col-md-10">
											<div class="form-group col-md-10">
												<input class="btn btn-primary"  onclick="updatecustall()" type="button" value="保 存 ">
											</div>
										</div>
									</div>
								</div>
							</form>
						</div>
					</div>
					</p>
				</div>
			</div>
		</div>

	</div>
	<!-- 资源分配 --> 
</body>

</html>